/*
 * Copyright (c) 2015-2020, www.dibo.ltd (service@dibo.ltd).
 * <p>
 * Licensed under the Apache License, Version 2.0 (the "License"); you may not
 * use this file except in compliance with the License. You may obtain a copy of
 * the License at
 * <p>
 * https://www.apache.org/licenses/LICENSE-2.0
 * <p>
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
 * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
 * License for the specific language governing permissions and limitations under
 * the License.
 */
package com.icesoft.system.entity;

import com.baomidou.mybatisplus.annotation.FieldFill;
import com.baomidou.mybatisplus.annotation.TableField;
import com.fasterxml.jackson.annotation.JsonFormat;
import com.gitee.sunchenbin.mybatis.actable.annotation.Column;
import com.gitee.sunchenbin.mybatis.actable.constants.MySqlTypeConstant;
import com.icesoft.framework.core.data.access.DataAccessCheckpoint;
import com.icesoft.framework.core.entity.BaseEntity;
import lombok.Getter;
import lombok.Setter;
import lombok.experimental.Accessors;

/**
 * 可登录用户Base类定义
 */
@Getter
@Setter
@Accessors(chain = true)
public abstract class BaseLoginUser extends BaseEntity {

	@TableField
	@Column(value = "phone", comment = "手机号", length = 12, type = MySqlTypeConstant.VARCHAR)
	private String phone;

	@TableField
	@Column(value = "email", comment = "邮箱", length = 255, type = MySqlTypeConstant.VARCHAR)
	private String email;

	@TableField
	@Column(value = "token", comment = "token")
	private String token;

	@DataAccessCheckpoint()
	@JsonFormat(shape = JsonFormat.Shape.STRING)
	@TableField(fill = FieldFill.INSERT)
	@Column(value = "company_id", comment = "公司", length = 50, type = MySqlTypeConstant.BIGINT)
	private Long companyId;

	/***
	 * 获取当前用户类型
	 */
	public abstract String getUserType();

}
